/**
 * File: DefaultModule.java
 * Created by: mhaimel
 * Created on: 3 Jul 2009
 * CVS:  $Id: DefaultModule.java,v 1.1 2009/08/05 15:16:12 mhaimel Exp $
 */
package uk.ac.ebi.curtain.configuration;

import uk.ac.ebi.curtain.CurtainContext;
import uk.ac.ebi.curtain.pipeline.CurtainPipelineManager;
import uk.ac.ebi.velvet.util.PathUtil;
import uk.ac.ebi.velvet.util.config.ConfigFactory;

import com.google.inject.AbstractModule;
import com.google.inject.name.Names;


/**
 * @author mhaimel
 *
 */
public class DefaultModule extends AbstractModule {

	private CurtainContext cxt;

	public DefaultModule(CurtainContext cxt) {
		this.cxt = cxt;
	}

	/**
	 * {@inheritDoc}
	 */
	@Override
	protected void configure() {
		bind(String.class)
			.annotatedWith(Names.named("pipeline-config"))
			.toInstance(PathUtil.getPath(CurtainPipelineManager.class.getPackage(), "curtain-pipeline.xml"));
		bind(CurtainConfig.class).toInstance(getConfig());
//		bind(NextContigHelper.class).to(CurtainHelper.class);
	}
	
	private CurtainConfig getConfig(){
		ConfigFactory.enablePropertyResource();
		
		CurtainConfig config = new CurtainConfig();
		ConfigFactory.populateBean(config);
		return config;
	}
	
	private CurtainContext getContext() {
		return cxt;
	}
}
